package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.model.request.LoginLogRequest;
import com.ytjj.qmyx.admin.model.request.OperationErrorLogRequest;
import com.ytjj.qmyx.admin.model.request.OperationLogRequest;
import com.ytjj.qmyx.admin.model.request.PayLogRequest;
import com.ytjj.qmyx.admin.service.LogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Description 日志
 * 
 * @Version 1.0
 * 
 */

@Slf4j
@RestController
@RequestMapping("/log")
public class LogController {
    @Resource
    private LogService logService;

    /**
     * 获取支付日志列表
     *
     * @param payLogRequest
     * @return
     */
    @PostMapping("/getPayLogList")
    public CommonResult getPayLog(@RequestBody PayLogRequest payLogRequest) {
        return CommonResult.success(logService.getPayLog(payLogRequest));
    }

    /**
     * 获取登录日志列表
     *
     * @param loginLogRequest
     * @return
     */
    @PostMapping("/getLoginLogList")
    public CommonResult getLoginLogList(@RequestBody LoginLogRequest loginLogRequest) {
        return CommonResult.success(logService.getLoginLogList(loginLogRequest));
    }

    /**
     * 获取操作日志列表
     *
     * @return
     */
    @PostMapping("/getOperLogList")
    public CommonResult getOperLogList(@RequestBody OperationLogRequest operationLogRequest) {
        return CommonResult.success(logService.getOperLogList(operationLogRequest));
    }

    /**
     * 获取异常操作日志列表
     *
     * @param operationErrorLogRequest
     * @return
     */
    @PostMapping("/getOperErrorLogList")
    public CommonResult getOperErrorLogList(@RequestBody OperationErrorLogRequest operationErrorLogRequest) {
        return CommonResult.success(logService.getOperErrorLogList(operationErrorLogRequest));
    }

    /**
     * 获取商品操作日志列表
     *
     * @return
     */
    @PostMapping("/getProductOperLogList")
    public CommonResult getProductOperLogList(@RequestBody OperationLogRequest operationLogRequest) {
        return CommonResult.success(logService.getOperLogList(operationLogRequest));
    }
}
